home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / comm / pirch32.zip / HANGMAN.PIL < prev    next >
Text File  |  1996-07-22  |  1KB  |  32 lines

  1. {
  2. -Usage /runscript [HANGMAN] <Game word or phrase> 
  3. -Required event: ON TEXT:!hangman*:#:/runscript [hangplay] # $nick *2
  4. -Required event: ON TEXT:!solve*:#:/runscript [hangsolve] # $nick *2
  5. -This is a IRC HANGMAN game written to demonstrate PIL scripting. 
  6. -This is a multi-script game....
  7. -[HANGMAN] (this script) starts a new game
  8. -[HANGPLAY] Processes the user guess at a letter
  9. -[HANGSOLVE] Processes a user guess at the entire word or phrase
  10. -HANGMAN in case you dont remember is a word game in which one person
  11. -(the controller of the game ie YOU) makes up a word and allows others
  12. -to guess letters. If the letter is in the word, the letter is filled in, if the letter is
  13. -not in the word, part of hangman is drawn... play continues until the word/phrase
  14. - is guessed or all of hangman is drawn (in which case he is hung)
  15. -(our hangman only has 4 parts)
  16. }
  17. $hmword := *1;
  18. $hmword := strlower($hmword);
  19. command('/define hangword=',$hmword);
  20. $hmsolved := '';
  21. for i := 1 to strlen($hmword) do
  22. begin
  23.     if strcopy($hmword,i,1) <> ' ' then
  24.         $hmsolved := $hmsolved + '-'
  25.     else
  26.         $hmsolved := $hmsolved + ' ';
  27. end;
  28. command('/define hangsolved=',$hmsolved);
  29. command('/define hangmissed=',0);
  30. command('/msg ',$audience,' ',\3,' Hangman Game has started: type !hangman <letter> to make a guess ',\3);
  31. command('/msg ',$audience,' ',\3,' Hangman: ',$hmsolved,\3);
  32.